<?php

	function pricing( $atts, $content = null ) {	
		extract( shortcode_atts( array(
		'row' => '',
		'color' => '',
		'featured_row' => ''
		), $atts ) );
		
		$result = '<table class="pricing_table" cellspacing="0">
		<tbody>
			'.do_shortcode($content).'
		</tbody>
		</table>';
		return $result;	
	}
	add_shortcode('pricing', 'pricing');
	
	function pricing_tr( $atts, $content = null ) {	
		extract( shortcode_atts( array(
		'class' => ''
		), $atts ) );
		
		if(esc_attr($class)){
			$cls = 'class="'.esc_attr($class).'"';
		}
		
		$result = '<tr '.$cls.'>
		'.do_shortcode($content).'
		</tr>';
		
		return $result;	
	}
	add_shortcode('pricing_tr', 'pricing_tr');
	
	
	
	function pricing_td( $atts, $content = null ) {	
		extract( shortcode_atts( array(
		'class' => ''
		), $atts ) );
		
		if(esc_attr($class)){
			$cls = 'class="'.esc_attr($class).'"';
		}
		
		$result = '<td '.$cls.'>'.do_shortcode($content).'</td>';
		
		return $result;	
	}
	add_shortcode('pricing_td', 'pricing_td');
	
	function pricing_button( $atts, $content = null ) {	
		extract( shortcode_atts( array(
		'link' => '',
		'target' => '',
		), $atts ) );
		
		$result = '<span class="button_span"><a href="'.esc_attr($link).'" target="'.esc_attr($target).'"><span>'.do_shortcode($content).'</span></a></span>';
		return $result;	
	}
	add_shortcode('pricing_button', 'pricing_button');
	
	
	function pricing_icon( $atts, $content = null ) {	
		extract( shortcode_atts( array(
		'type' => ''
		), $atts ) );
		
		$result = '<span class="price_icons '.esc_attr($type).'"></span>';
		return $result;	
	}
	add_shortcode('pricing_icon', 'pricing_icon');
	
	

	function toggle( $atts, $content = null ) {	
		extract( shortcode_atts( array(
		'title' => 'toggle'
		), $atts ) );
		
		$result = '<h3 class="toggler"><a href="javascript:void(0);">'.esc_attr($title).'</a></h3>
		<div class="toggle_container">
			<div class="block">
				<p>'.do_shortcode($content).'</p>
			</div>
		</div>';
		return $result;	
	}
	add_shortcode('toggle', 'toggle');
	
	
	function highlight( $atts, $content = null ) {	
		extract( shortcode_atts( array(
		'bgcolor' => 'highlight',
		'text_color' => 'highlight'
		), $atts ) );
		
		$result = '<span class="highlight" style="background-color:'.esc_attr($bgcolor).'; color:'.esc_attr($text_color).';">'.do_shortcode($content).'</span>';
		return $result;	
	}
	add_shortcode('highlight', 'highlight');
	
	
	function tabs( $atts, $content = null ) {	
		extract( shortcode_atts( array(
		'titles' => 'tabs'
		), $atts ) );
		
		$tab_titles  = esc_attr($titles);
		$tab_totals = explode(",", $tab_titles);
		

		$result = '<div>';

		$result .= '<ul class="tabs">';
		$s = 1;
		for ( $i = 0; $i <= count($tab_totals)-1; $i++) {
			$result .= '<li><a href="#tab'.$s++.'">'.trim($tab_totals[$i]).'</a></li>';
		} 
		$result .= '</ul>';
		
		$result .= '<div class="tab_container">';
		$result .= do_shortcode($content);
		$result .= '</div>';
		$result .= '</div>';
		
		return $result;	
	}
	add_shortcode('tabs', 'tabs');
	
	
	function tab( $atts, $content = null ) {	
		$result = '<div class="tab_content"><p>';
		$result .= do_shortcode($content);
		$result .= '</p></div>';
		return $result;	
	}
	add_shortcode('tab', 'tab');
	
	
	function button( $atts, $content = null ) {	
		extract( shortcode_atts( array(
		'link' => 'button',
		'target' => 'button',
		), $atts ) );
    
		return '<span class="simple_button"><a href="'.esc_attr($link).'" target="'.esc_attr($target).'"><span>'.$content.'</span></a></span>';	
	}
	add_shortcode('button', 'button');

	function image( $atts, $content = null ) {	
		extract( shortcode_atts( array(
		'small' => '',
		'big' => '',
		'align' => '',
		'width' => '',
		'height' => '',
		'type' => '',
		'skin' => '',
		'link' => '',
		'target' => '',
		), $atts ) );
		
		$content =  '<div class="image_frame_'.esc_attr($align).'">';
		
		if(esc_attr($skin) != "off"){
		$content .= '<div class="image_skin">';
		$content .= '<div class="image_inside_border">';
		$content .= '<div class="image_skin_anime" style="width:'.esc_attr($width).'px; height:'.esc_attr($height).'px;">';
		$content .= '<div class="image_holder" id="zoom_'.esc_attr($type).'">';
		}
		
		if(esc_attr($big) != ""){
		$content .= '<a href="'.esc_attr($big).'" rel="prettyPhoto[canyon_gallery]">';
		}
		
		if(esc_attr($link) != ""){
		$content .= '<a href="'.esc_attr($link).'" target="'.esc_attr($target).'">';
		}
		
		$content .= '<img src="'.esc_attr($small).'" style="width:'.esc_attr($width).'px; height:'.esc_attr($height).'px;" alt=""/>';
		
		if(esc_attr($big) != "" or esc_attr($link) != ""){
		$content .= '</a>';
		}
		
		
		if(esc_attr($skin) != "off"){
		$content .= '</div></div></div></div>';
		}
		
		$content .='</div>';
		
	return $content;
	
	}
	add_shortcode('image', 'image');

	/* begin list shortcode */
	function arrow_list( $atts, $content = null ) {	$content = str_replace('<ul>', '<ul class="ul_arrow_list">', do_shortcode($content)); return $content;	}
	function check_list( $atts, $content = null ) {	$content = str_replace('<ul>', '<ul class="ul_check_list">', do_shortcode($content)); return $content;	}
	function plus_list( $atts, $content = null ) {	$content = str_replace('<ul>', '<ul class="ul_plus_list">', do_shortcode($content)); return $content; 	}
	function star_list( $atts, $content = null ) {	$content = str_replace('<ul>', '<ul class="ul_star_list">', do_shortcode($content)); return $content; 	}
	function pencil_list( $atts, $content = null ){	$content = str_replace('<ul>', '<ul class="ul_pencil_list">', do_shortcode($content)); return $content;	}

	add_shortcode('arrow_list', 'arrow_list');
	add_shortcode('check_list', 'check_list');
	add_shortcode('star_list', 'star_list');
	add_shortcode('plus_list', 'plus_list');
	add_shortcode('pencil_list', 'pencil_list');
	/* end list shortcode */

	/* begin boxes shortcode */
	function download_box( $atts, $content = null ){	return '<div class="info_boxes download_box">' . do_shortcode($content) . '</div>';	}
	function info_box( $atts, $content = null ){		return '<div class="info_boxes info_box">' . do_shortcode($content) . '</div>';	}
	function warning_box( $atts, $content = null ){		return '<div class="info_boxes warning_box">' . do_shortcode($content) . '</div>';	}
	function note_box( $atts, $content = null ){		return '<div class="info_boxes note_box">' . do_shortcode($content) . '</div>';	}
	function message_box( $atts, $content = null ){		return '<div class="info_boxes message_box">' . do_shortcode($content) . '</div>';	}
	function simple_box( $atts, $content = null ){		return '<div class="info_boxes simple_box">' . do_shortcode($content) . '</div>';	}

	add_shortcode('download_box', 'download_box');
	add_shortcode('info_box', 'info_box');
	add_shortcode('warning_box', 'warning_box');
	add_shortcode('note_box', 'note_box');
	add_shortcode('message_box', 'message_box');	
	add_shortcode('simple_box', 'simple_box');	
	/* end boxes shortcode */
	
	function dropcap( $atts, $content = null ) {	    return '<div class="dropcap">'. do_shortcode($content) .'</div>';	}
	add_shortcode('dropcap', 'dropcap');
	
	function justify( $atts, $content = null ) {	    return '<div class="text_justify">'. do_shortcode($content) .'</div>';	}
	add_shortcode('justify', 'justify');

	function blockquote( $atts, $content = null ) {		    return '<blockquote class="pquote"><p>'. do_shortcode($content) .'</p></blockquote>';			}
	function blockquote_left( $atts, $content = null ) {	return '<blockquote class="pquote_left"><p>'. do_shortcode($content) .'</p></blockquote>';	}
	function blockquote_right( $atts, $content = null ) {	return '<blockquote class="pquote_right"><p>'. do_shortcode($content) .'</p></blockquote>';	}
	function blockquote_message( $atts, $content = null ) {	return '<blockquote class="pquote_message"><p>'. do_shortcode($content) .'</p></blockquote>';	}
	add_shortcode('blockquote', 'blockquote');
	add_shortcode('blockquote_left', 'blockquote_left');
	add_shortcode('blockquote_right', 'blockquote_right');
	add_shortcode('blockquote_message', 'blockquote_message');

	
	function divider_pad( $atts, $content = null ) {	
		extract( shortcode_atts( array(
		'padding' => 'divider_pad',
		), $atts ) );
    	return '<span class="divider_pad" style="padding-top:'.esc_attr($padding).'px; padding-bottom:'.esc_attr($padding).'px;"></span>';	
	}
	add_shortcode('divider_pad', 'divider_pad');
	
	function divider_hr( $atts, $content = null ) {			return '<span class="divider_hr"></span>';		}
	function divider_with_top( $atts, $content = null ) {	return '<span class="divider_with_top"><a href="#top">Top</a></span>';		}
	add_shortcode('divider_hr', 'divider_hr');
	add_shortcode('divider_with_top', 'divider_with_top');
	
	
	function one_half( $atts, $content = null ) {			return '<div class="basic_columns one_half">'.do_shortcode($content).'</div>';				}	
	function one_half_last( $atts, $content = null ) {		return '<div class="basic_columns one_half last">'.do_shortcode($content).'</div>';			}
	add_shortcode('one_half', 'one_half');
	add_shortcode('one_half_last', 'one_half_last');
	
	
	function one_third( $atts, $content = null ) {			return '<div class="basic_columns one_third">'.do_shortcode($content).'</div>';				}
	function one_third_last( $atts, $content = null ) {		return '<div class="basic_columns one_third last">'.do_shortcode($content).'</div>';		}
	add_shortcode('one_third', 'one_third');
	add_shortcode('one_third_last', 'one_third_last');

	
	function one_fourth( $atts, $content = null ) {			return '<div class="basic_columns one_fourth">'.do_shortcode($content).'</div>';			}
	function one_fourth_last( $atts, $content = null ) {	return '<div class="basic_columns one_fourth last">'.do_shortcode($content).'</div>';		}
	add_shortcode('one_fourth', 'one_fourth');
	add_shortcode('one_fourth_last', 'one_fourth_last');
	
	
	function one_fifth( $atts, $content = null ) {			return '<div class="basic_columns one_fifth">'.do_shortcode($content).'</div>';				}
	function one_fifth_last( $atts, $content = null ) {		return '<div class="basic_columns one_fifth last">'.do_shortcode($content).'</div>';		}
	add_shortcode('one_fifth', 'one_fifth');
	add_shortcode('one_fifth_last', 'one_fifth_last');
	

	function two_third( $atts, $content = null ) {			return '<div class="basic_columns two_third">'.do_shortcode($content).'</div>';				}
	function two_third_last( $atts, $content = null ) {		return '<div class="basic_columns two_third last">'.do_shortcode($content).'</div>';		}
	add_shortcode('two_third', 'two_third');
	add_shortcode('two_third_last', 'two_third_last');
		

	function three_fourth_last( $atts, $content = null ) {	return '<div class="basic_columns three_fourth last">'.do_shortcode($content).'</div>';		}	
	function three_fourth( $atts, $content = null ) {		return '<div class="basic_columns three_fourth">'.do_shortcode($content).'</div>';			}
	add_shortcode('three_fourth', 'three_fourth');
	add_shortcode('three_fourth_last', 'three_fourth_last');


	function sitemap_posts($atts){
		extract(shortcode_atts(array('limit' => 5), $atts));
	 
		return '<div class="page_right_navigation sitemap"><ul>' . wp_get_archives('type=postbypost&limit=' . $limit . '&echo=0') . '</ul></div>';
	}
	 
	add_shortcode('sitemap_posts', 'sitemap_posts');

	function sitemap_archives($atts){
		return '<div class="page_right_navigation sitemap"><ul>' . wp_get_archives('type=monthly&echo=0') . '</ul></div>';
	}
	 
	add_shortcode('sitemap_archives', 'sitemap_archives');	

	function sitemap_pages(){
		$content = '<div class="page_right_navigation sitemap"><ul>'.wp_list_pages('sort_order=ASC&sort_column=menu_order&title_li=&echo=0').'</ul></div>';
		$content = str_replace("current_page_item" , "", $content);
		return $content;
	}
	add_shortcode('sitemap_pages', 'sitemap_pages');

	function sitemap_categories(){
		$variable = wp_list_categories('echo=0&title_li=');
		$content = '<div class="page_right_navigation sitemap"><ul>'.$variable.'</ul></div>';
		return $content;
	}
	add_shortcode('sitemap_categories', 'sitemap_categories');



	
	
?>